package com.ruoyi.column.service.impl;

import java.util.List;

import com.ruoyi.common.constant.SysConstants;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.column.mapper.SysColumnCourseMapper;
import com.ruoyi.column.domain.SysColumnCourse;
import com.ruoyi.column.service.ISysColumnCourseService;

/**
 * 专栏课程Service业务层处理
 * 
 * @author yjf
 */
@Service
public class SysColumnCourseServiceImpl implements ISysColumnCourseService 
{
    @Autowired
    private SysColumnCourseMapper sysColumnCourseMapper;

    /**
     * 查询专栏课程
     * 
     * @param id 专栏课程主键
     * @return 专栏课程
     */
    @Override
    public SysColumnCourse selectSysColumnCourseById(Long id)
    {
        return sysColumnCourseMapper.selectSysColumnCourseById(id);
    }

    /**
     * 查询专栏课程列表
     * 
     * @param sysColumnCourse 专栏课程
     * @return 专栏课程
     */
    @Override
    public List<SysColumnCourse> selectSysColumnCourseList(SysColumnCourse sysColumnCourse)
    {

        if (StringUtils.isNull(sysColumnCourse.getDelFlag())) {
            sysColumnCourse.setDelFlag(SysConstants.CONSTANT_STR0);
        }
        return sysColumnCourseMapper.selectSysColumnCourseList(sysColumnCourse);
    }

    /**
     * 新增专栏课程
     * 
     * @param sysColumnCourse 专栏课程
     * @return 结果
     */
    @Override
    public int insertSysColumnCourse(SysColumnCourse sysColumnCourse)
    {
        sysColumnCourse.setCreateTime(DateUtils.getNowDate());
        sysColumnCourse.setUpdateTime(DateUtils.getNowDate());
        return sysColumnCourseMapper.insertSysColumnCourse(sysColumnCourse);
    }

    /**
     * 修改专栏课程
     * 
     * @param sysColumnCourse 专栏课程
     * @return 结果
     */
    @Override
    public int updateSysColumnCourse(SysColumnCourse sysColumnCourse)
    {
        sysColumnCourse.setUpdateTime(DateUtils.getNowDate());
        return sysColumnCourseMapper.updateSysColumnCourse(sysColumnCourse);
    }

    /**
     * 批量删除专栏课程
     * 
     * @param ids 需要删除的专栏课程主键
     * @return 结果
     */
    @Override
    public int deleteSysColumnCourseByIds(Long[] ids)
    {
        return sysColumnCourseMapper.deleteSysColumnCourseByIds(ids);
    }

    /**
     * 删除专栏课程信息
     * 
     * @param id 专栏课程主键
     * @return 结果
     */
    @Override
    public int deleteSysColumnCourseById(Long id)
    {
        return sysColumnCourseMapper.deleteSysColumnCourseById(id);
    }
}
